<template>
  <div class="vol-dialog">
    <el-drawer :title="title" :modal="modal" :icon="icon" v-model="vmodel" :direction="direction" :size="width"
      :before-close="handleClose">
      <el-scrollbar :max-height="contentHeight">
        <div v-if="inited" style="min-height: 50px" class="srcoll-content" :style="{ padding: padding + 'px' }">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane name="ssfa">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>市县实施方案</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      实施方案文件：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('ssfa', item.ssfaFileUrl, item.ssfaName)">{{
                          item.ssfaName
                        }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：公文或副封面和技术方案二选一进行上传，文件格式必须为.pdf；文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.ssfa_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.ssfa_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane name="jcbg">
              <template #label>
                <div class="custom-tabs-label" style="padding-left: 0px; margin-left: 0px">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>任务区检查报告</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      任务区检查报告：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('jcbg', item.jcbgFileUrl, item.jcbgName)">{{
                          item.jcbgName
                        }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.jcbg_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.jcbg_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="任务区技术总结报告" name="zjbg">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>任务区技术总结报告</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      任务区技术总结报告：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('zjbg', item.zjbgFileUrl, item.zjbgName)">{{
                          item.zjbgName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.zjbg_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.zjbg_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="两级检查记录" name="ljjl">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>两级检查记录</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div style="width: 50%; float: left">
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div style="float: left; width: 100%">
                        <div style="width: 60%; float: left">
                          一级检查记录：
                        </div>
                        <div style="float: left; margin-left: 25px">
                          <el-radio-group v-model="item.yj_state" @change="btnCheck(item)">
                            <el-radio :label="1">审核通过</el-radio>
                            <el-radio :label="0">审核不通过</el-radio>
                          </el-radio-group>
                        </div>
                      </div>
                      <div style="float: left; width: 80%; margin-left: 80px" v-for="(model, bIndex) in item.yjjllist"
                        :key="bIndex">
                        <div style="">
                          <a style="color: blue; cursor: pointer"
                            @click="getShowPdf('yjjl', model.url, model.yj_file_name, bIndex)">{{
                              model.name
                            }}</a>
                        </div>
                      </div>
                    </div>
                    <div style="font-size: 13px; color: red; clear: both">
                      <a @click="getdownFile('yjjl')" style="
                          cursor: pointer;
                          color: blue;
                          float: right;
                          margin-right: 100px;
                        ">一键下载</a>
                    </div>
                    <div style="font-size: 13px; color: red; clear: both">
                      说明：文件格式要求为：pdf/zip/rar,优先使用pdf格式
                    </div>
                    <div style="font-size: 13px; color: red; clear: both">
                      <p>
                        注意：一级检查记录应包括：&nbsp;&nbsp;1.DOM套合差统计表和附件资料&nbsp;2.监测要素（国家规定格式）&nbsp;3.元数据检查记录表&nbsp;4.实地照片与外业调查文件&nbsp;
                      </p>
                    </div>
                    <div class="upload-container" style="clear: both">
                      <div class="upload-item">
                        <div style="font-size: 13px; line-height: 32px">
                          <div>审核意见：</div>
                          <div style="width: 90%">
                            <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                              v-model="item.yj_shyj">
                            </el-input>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div style="width: 50%; float: left">
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div style="float: left; width: 100%">
                        <div style="width: 60%; float: left">
                          二级检查记录：
                        </div>
                        <div style="float: left; margin-left: 25px">
                          <el-radio-group v-model="item.lj_state" @change="btnCheck(item)">
                            <el-radio :label="1">审核通过</el-radio>
                            <el-radio :label="0">审核不通过</el-radio>
                          </el-radio-group>
                        </div>
                      </div>
                      <div style="float: left; width: 80%; margin-left: 80px" v-for="(model, bIndex) in item.ljjllist"
                        :key="bIndex">
                        <div style="">
                          <a style="color: blue; cursor: pointer"
                            @click="getShowPdf('ljjl', model.url, model.lj_file_name, bIndex)">{{
                              model.name
                            }}</a>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div style="font-size: 13px; color: red; clear: both">
                  <a @click="getdownFile('ljjl')" style="
                      cursor: pointer;
                      color: blue;
                      float: right;
                      margin-right: 100px;
                    ">一键下载</a>
                </div>
                <div style="font-size: 13px; color: red; clear: both">
                  说明：文件格式要求为：pdf/zip/rar,优先使用pdf格式
                </div>
                <div style="font-size: 13px; color: red; clear: both">
                  <p>
                    注意：二级检查记录应包括：&nbsp;&nbsp;1.附件资料和一查检查记录表&nbsp;2.监测要素&nbsp;3.元数据检查记录表&nbsp;4.实地照片与外业调查文件
                  </p>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div style="width: 90%">
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.lj_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="外业调查核查记录表" name="wydcjl">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>外业调查核查记录表</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      外业调查核查记录表：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('wydcjl', item.wydcjlFileUrl, item.wydcjlName)">{{
                          item.wydcjlName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.wydcjl_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.wydcjl_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="机检记录" name="jjbg">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>机检记录</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div style="width: 50%; float: left">
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      元数据机检记录及错误未修改说明：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('jjbg', item.jjbgFileUrl, item.jjbgName)">{{
                          item.jjbgName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.jjbg_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div style="width: 90%">
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.jjbg_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <div style="width: 50%; float: left">
                <div class="upload-container" style="width: 60%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      监测数据机检记录及错误未修改说明：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('jjbg', item.jccwwxgsmFileUrl, item.jccwwxgsmName)">{{
                          item.jccwwxgsmName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.jccwwxgsm_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div style="width: 90%">
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.jccwwxgsm_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="接边记录表" name="djsjy" v-if="ifShowPanel">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>地市级交验</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      周边行政区接边记录或说明：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('djsjy', item.djsjyFileUrl, item.djsjyName)">{{
                          item.djsjyName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.djsjy_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.djsjy_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <!-- <el-tab-pane label="委托函" name="wth">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>委托函</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      委托函：<a style="color: blue; cursor: pointer" @click="getShowPdf('wth', item.wthFileUrl)">{{
                        item.wthName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.wth_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.wth_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane> -->
            <el-tab-pane label="抽样单" name="cyd">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>抽样单</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template> 
             <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      抽样单：<a style="color: blue; cursor: pointer" @click="getShowPdf('cyd', item.cydFileUrl)">{{
                        item.cydName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.cyd_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.cyd_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="测绘资料交验移交清单" name="chzlyy">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26">
                    <CustomIcon />
                  </i>
                  <span>测绘资料交验移交清单</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      测绘资料交验移交清单：<a style="color: blue; cursor: pointer"
                        @click="getShowPdf('chzlyy', item.chzlyyFileUrl, item.chzlyyName)">{{
                          item.chzlyyName }}</a>
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                <div class="upload-container" style="float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <el-radio-group v-model="item.chzlyy_state">
                        <el-radio :label="1">审核通过</el-radio>
                        <el-radio :label="0">审核不通过</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </div>
                <div class="upload-container" style="clear: both">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <div>审核意见：</div>
                      <div>
                        <el-input type="textarea" :autosize="{ minRows: 5, maxRows: 4 }" placeholder=""
                          v-model="item.chzlyy_shyj">
                        </el-input>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
          </el-tabs>
          <div>
            <el-row type="flex" justify="center" align="middle" style="height: 10vh">
              <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4">
                <el-button type="primary" class="edit_btn" @click="btnNext"
                  style="display: none">下一项</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
                <el-button type="primary" class="edit_btn" @click="btnSubmit">提交审核</el-button>
              </el-col>
            </el-row>
            <div style="color: red;line-height: 25px;"> {{ item.mssgage }}</div>
          </div>
        </div>
      </el-scrollbar>
    </el-drawer>
    <el-dialog v-model="fmodel" :pdfwidth="pdfwidth" :modal="fmodal" :before-close="handleFileClose">
      <template #header> <i :class="icon"></i> {{ title }} </template>
      <el-scrollbar :max-height="contentHeight">
        <div v-if="inited" style="min-height: 500px" class="srcoll-content" :style="{ padding: padding + 'px' }">
          <!-- <iframe
            :src="pdfUrl"
            height="100%"
            frameborder="0"
            scrolling="auto"
            width="100%"
            style="z-index: 1000; margin: 0 auto; height: 550px"
            sandbox="allow-scripts allow-top-navigation allow-same-origin allow-popups"
          ></iframe> -->
          <vue-pdf
            src="https://yspt.ks3-cn-beijing.ksyuncs.com/340000/340200/340202/安徽省-合肥市巢湖市-2024年城市国土空间监测-第1次预审/c5f7a6a2-ab3e-4bfb-96fa-fa5b0f5e28b4.pdf" />
        </div>
      </el-scrollbar>
    </el-dialog>

    <el-dialog title="设置线下交验时间" v-model="dialogVisible" width="23%" style="height: 200px">
      <el-date-picker style="margin: 25px 0px; width: 100%" v-model="selectedDate" type="date" placeholder="请选择线下交验时间">
      </el-date-picker>
      <!-- <el-date-picker v-model="selectedDate" type="date" placeholder="Select date"></el-date-picker> -->
      <div slot="footer" class="dialog-footer" style="width: 25px; margin: 0px auto">
        <el-button type="primary" @click="confirmDate">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { defineComponent, ref, watch, reactive, h } from "vue";
import * as pdfjsLib from "pdfjs-dist";
import * as pdfjsWorker from "pdfjs-dist/build/pdf.worker.js";
const data_id = ref("");
export default defineComponent({
  props: {
    modelValue: false,

    pdfUrl: {
      type: String,
      default: "",
    },
    lazy: {
      //是否开启懒加载2020.12.06
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "基本信息",
    },
    detailParams: {
      type: String,
      default: "",
    },
    height: {
      type: Number,
      default: 200,
    },
    width: {
      type: Number,
      default: 1500,
    },
    pdfwidth: {
      type: Number,
      default: 1000,
    },
    padding: {
      type: Number,
      default: 16,
    },
    modal: {
      //是否需要遮罩层
      type: Boolean,
      default: true,
    },
    ifShowPanel:{
      type: Boolean,
      default: true,
    },
    fmodal: {
      //是否需要遮罩层
      type: Boolean,
      default: true,
    },
    draggable: {
      //启用可拖拽功能
      type: Boolean,
      default: false,
    },
    mask: {
      type: Boolean,
      default: true,
    },
    onModelClose: {
      //2021.07.11增加弹出框关闭事件
      type: Function,
      default: (iconClick) => {
        return true;
      },
    },
    fistfileName: {
      type: String,
      default: "",
    },
    fistfileUrl: {
      type: String,
      default: "",
    },
  },
  setup(props, context) {
    const item = reactive({
      ssfaName: "",
      jcbgName: "",
      zjbgName: "",
      yjjllist: [],
      ljjllist: [],
      ychecked: false,
      lchecked: false,
      wydcjlName: "",
      jjbgName: "",
      jccwwxgsmName: "",
      djsjyName: "",
      wthName: "",
      cydName: "",
      chzlyyName: "",
      ssfaFileUrl: "",
      jcbgFileUrl: "",
      zjbgFileUrl: "",
      // yj_szzsyxtFileUrl: "",
      // yj_jcsjcgFileUrl: "",
      // yj_scysjFileUrl: "",
      // yj_sdzpsjFileUrl: "",
      // yj_wydcwjFileUrl: "",
      // lj_szzsyxtFileUrl: "",
      // lj_jcsjcgFileUrl: "",
      // lj_scysjFileUrl: "",
      // lj_sdzpsjFileUrl: "",
      // lj_wydcwjFileUrl: "",
      wydcjlFileUrl: "",
      jjbgFileUrl: "",
      jccwwxgsmFileUrl: "",
      djsjyFileUrl: "",
      wthFileUrl: "",
      cydFileUrl: "",
      chzlyyFileUrl: "",
      radioValue: 0,
      ssfa_state: "",
      jcbg_state: "",
      zjbg_state: "",
      yj_state: "",
      lj_state: "",
      wydcjl_state: "",
      jjbg_state: "",
      jccwwxgsm_state: "",
      djsjy_state: "",
      wth_state: "",
      cyd_state: "",
      chzlyy_state: "",
      ssfa_shyj: "",
      jcbg_shyj: "",
      zjbg_shyj: "",
      wydcjl_shyj: "",
      jjbg_shyj: "",
      jccwwxgsm_shyj: "",
      djsjy_shyj: "",
      wth_shyj: "",
      cyd_shyj: "",
      chzlyy_shyj: "",
      data_id: "",
      projectname: "",
      yj_isys_dom: "",
      lj_isys_dom: "",
      lj_shyj: "",
      yj_shyj: "",
      yj_file_path: [],
      lj_file_path: [],
      mssgage: "",
      lastmodel: null
    });

    const clientHeight = document.body.clientHeight * 0.95 - 60;
    const inited = ref(true);
    const vmodel = ref(false);
    const shyj = ref("");
    const fmodel = ref(false); //文件
    const dialogVisible = ref(false); //日期
    const selectedDate = ref(""); //选择的线下交验日期
    const footer = ref(false);
    const top = ref(100);
    vmodel.value = props.modelValue;
    footer.value = !!context.slots.footer;

    // 设置选择器选项，限制日期选择

    const contentHeight = ref(200);
    contentHeight.value = props.height;

    const handleClose = (done, iconClose) => {
      let result = props.onModelClose(!!iconClose);
      if (result === false) return;
      vmodel.value = false;
      context.emit("update:modelValue", false);
      done && done();
    };
    const getDatePicker = (val) => {
      const now = new Date();
      const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
      const targetDate = new Date(
        val.getFullYear(),
        val.getMonth(),
        val.getDate()
      );
      return targetDate < today; // 禁用今天之前的日期
    };
    const calcHeight = (val) => {
      contentHeight.value = clientHeight - 30;
      return clientHeight / -2 + "px";
    };
    const handleClick = (tab, event) => { };

    top.value = calcHeight();
    watch(
      () => props.modelValue,
      (newVal, oldVal) => {
        vmodel.value = newVal;
      }
    );
    watch(
      () => props.height,
      (newVal, oldVal) => {
        top.value = calcHeight();
      }
    );
    watch(
      () => props.detailParams,
      (newVal, oldVal) => {
        const model = props.detailParams.thisdata;
        const audititem = props.detailParams.lastitem;
        item.lastmodel = props.detailParams.lastitem;
        item.ljjllist = [];
        item.yjjllist = [];
        if (model != null) {
          item.data_id = model.id;
          item.projectname = model.projectname;
          item.ssfaName = model.ssfa_name;
          item.ssfaFileUrl = model.ssfa;
          item.jcbgName = model.jcbg_name;
          item.jcbgFileUrl = model.jcbg;
          item.zjbgName = model.zjbg_name;
          item.zjbgFileUrl = model.zjbg;
          debugger;
          if (model.yj_file_name !== null && model.yj_file_name !== "") {
            var yj_listnames = model.yj_file_name.split("|");
            var yj_listpaths = model.yj_file_path.split("|");
            if (yj_listnames.length == 4 && yj_listpaths.length == 4) {
              for (var i = 0; i < yj_listnames.length; i++) {
                for (var j = 0; j < yj_listpaths.length; j++) {
                  if (i == j) {
                    var yj_list = {
                      name: yj_listnames[i],
                      url: yj_listpaths[j],
                    };
                    item.yjjllist.push(yj_list);
                  }
                }
              }
            }
          }
          debugger;
          if (model.lj_file_name !== null && model.lj_file_name !== "") {
            var lj_listnames = model.lj_file_name.split("|");
            var lj_listpaths = model.lj_file_path.split("|");
            if (lj_listnames.length == 4 && lj_listnames.length == 4) {
              for (var i = 0; i < lj_listnames.length; i++) {
                for (var j = 0; j < lj_listpaths.length; j++) {
                  if (i == j) {
                    var lj_list = {
                      name: lj_listnames[i],
                      url: lj_listpaths[j],
                    };
                    item.ljjllist.push(lj_list);
                  }
                }
              }
            }
          }
          item.wydcjlName = model.wydcjl_name;
          item.wydcjlFileUrl = model.wydcjl;
          item.jjbgName = model.jjbg_name;
          item.jccwwxgsmName = model.jccwwxgsm_name;
          item.jjbgFileUrl = model.jjbg;
          item.jccwwxgsmFileUrl = model.jccwwxgsm;
          item.djsjyName = model.djsjy_name;
          item.djsjyFileUrl = model.djsjy;
          item.wthName = model.wth_name;
          item.wthFileUrl = model.wth;
          item.cydName = model.cyd_name;
          item.cydFileUrl = model.cyd;
          item.chzlyyName = model.chzlyy_name;
          item.chzlyyFileUrl = model.chzlyy;
        }

        if (audititem != null) {
          if (audititem.ssfa_sh_state === 0) {
            item.mssgage += "实施方案、";
          }
          if (audititem.jcbg_sh_state === 0) {
            item.mssgage += "检查报告、";
          }
          if (audititem.zjbg_sh_state === 0) {
            item.mssgage += "总结报告、";
          }
          if (
            audititem.lj_state === 0 ||
            audititem.yj_state === 0
          ) {
            item.mssgage += "两级检查记录、";
          }
          if (audititem.wydcjl_sh_state === 0) {
            item.mssgage += "外业调查核查记录表、";
          }
          if (
            audititem.jjbg_sh_state === 0 ||
            audititem.jccwwxgsm_sh_state === 0
          ) {
            item.mssgage += "机检记录、";
          }
          if (audititem.djsjy_sh_state === 0) {
            item.mssgage += "地市级交验、";
          }
          // if (audititem.wth_sh_state === 0) {
          //   item.mssgage += "委托函、";
          // }
          if (audititem.cyd_sh_state === 0) {
            item.mssgage += "抽样单、";
          }
          if (audititem.chzlyy_sh_state === 0) {
            item.mssgage += "测绘资料交验移交清单";
          }
          if (item.mssgage != "") {
            item.mssgage = item.mssgage.substring(0, item.mssgage.length - 1);

            item.mssgage = "上次审核不通过内容项为：" + item.mssgage;
          }


        }
      }
    );
    return {
      handleClose,
      inited,
      vmodel,
      fmodel,
      footer,
      top,
      calcHeight,
      handleClick,
      contentHeight,
      activeName: "ssfa",
      item,
      shyj,
      dialogVisible, // 控制弹出框的显示与隐藏
      selectedDate, // 选择的日期
      getDatePicker,
    };
  },
  mounted() {
  },
  methods: {
    btnCheck(item) { },
    btnSubmit() {
      // if(this.item.mssgage!="")
      // {
      //   this.$alert(
      //     "上次审核不通过内容项为："+this.item.mssgage +
      //           "",
      //         "消息提示",
      //         {
      //           confirmButtonText: "确定",
      //           type: "error",
      //           callback: (action) => {},
      //         }
      //       );
      // }
      if (this.item.lastmodel != null) {
        if ((this.item.lastmodel.ssfa_sh_state === 0 && this.item.ssfa_state === "") ||
          (this.item.lastmodel.zjbg_sh_state === 0 && this.item.zjbg_state === "") ||
          (this.item.lastmodel.jcbg_sh_state === 0 && this.item.jcbg_state === "") ||
          (this.item.lastmodel.wydcjl_sh_state === 0 && this.item.wydcjl_state === "") ||
          (this.item.lastmodel.jjbg_sh_state === 0 && this.item.jjbg_state === "") ||
          (this.item.lastmodel.jccwwxgsm_sh_state === 0 && this.item.jccwwxgsm_state === "") ||
          // (this.item.lastmodel.wth_sh_state === 0 && this.item.wth_state === "") ||
           (this.item.lastmodel.cyd_sh_state === 0 && this.item.cyd_state === "") ||
          (this.item.lastmodel.chzlyy_sh_state === 0 && this.item.chzlyy_state === "") ||
          (this.item.lastmodel.yj_state === 0 && this.item.yj_state === "") ||
          (this.item.lastmodel.lj_state === 0 && this.item.lj_state === "")
        ) {
          if (this.item.lastmodel.ssfa_sh_state === 0 && this.item.ssfa_state === "") {
            this.$message.error("【任务区实施方案或技术总结报告】尚未审核！");
          }
          if (this.item.lastmodel.jcbg_sh_state === 0 && this.item.jcbg_state === "") {
            this.$message.error("【任务区检查报告】尚未审核！");
          }
          if (this.item.lastmodel.zjbg_sh_state === 0 && this.item.zjbg_state === "") {
            this.$message.error("【技术总结报告】尚未审核！");
          }
          if (this.item.lastmodel.wydcjl_sh_state === 0 && this.item.wydcjl_state === "") {
            this.$message.error("【外业调查核查记录表】尚未审核！");
          }
          if ((this.item.lastmodel.jjbg_sh_state === 0 && this.item.jjbg_state === "") ||
            (this.item.lastmodel.jccwwxgsm_sh_state === 0 && this.item.jccwwxgsm_state === "")) {
            this.$message.error("【机检记录】中尚有未审核的内容项！");
          }
          // if (this.item.lastmodel.wth_sh_state === 0 && this.item.wth_state === "") {
          //   this.$message.error("【委托函】尚未审核！");
          // }
          if (this.item.lastmodel.cyd_sh_state === 0 && this.item.cyd_state === "") {
            this.$message.error("【抽样单】尚未审核！");
          }
          if (this.item.lastmodel.chzlyy_sh_state === 0 && this.item.chzlyy_state === "") {
            this.$message.error("【测绘资料交验移交清单】尚未审核！");
          }

          if ((this.item.lastmodel.yj_state === 0 && this.item.yj_state === "") ||
            (this.item.lastmodel.lj_state === 0 && this.item.lj_state === "")) {
            this.$message.error("【两级检查】尚未审核！");
          }
          return;
        }
        if (
          (this.item.lastmodel.ssfa_sh_state === 0 && this.item.ssfa_state == 1) &&
          (this.item.lastmodel.zjbg_sh_state === 0 && this.item.zjbg_state == 1) &&
          (this.item.lastmodel.jcbg_sh_state === 0 && this.item.jcbg_state == 1) &&
          (this.item.lastmodel.wydcjl_sh_state === 0 && this.item.wydcjl_state == 1) &&
          (this.item.lastmodel.jjbg_sh_state === 0 && this.item.jjbg_state == 1) &&
          (this.item.lastmodel.jccwwxgsm_sh_state === 0 && this.item.jccwwxgsm_state == 1) &&
          // (this.item.lastmodel.wth_sh_state === 0 && this.item.wth_state == 1) &&
           (this.item.lastmodel.cyd_sh_state === 0 && this.item.cyd_state == 1) &&
          (this.item.lastmodel.chzlyy_sh_state === 0 && this.item.chzlyy_state == 1) &&
          (this.item.lastmodel.yj_state === 0 && this.item.yj_state == 1) &&
          (this.item.lastmodel.lj_state === 0 && this.item.lj_state == 1)
        ) {
          this.http
            .post(
              "/api/zm_data_record/AdminGetDetaileByID?id=" + this.item.data_id
            )
            .then((result) => {
              if (result.Data.thisdata != undefined) {
                if (
                  result.Data.thisdata.djsjy != null &&
                  result.Data.thisdata.djsjy != null &&
                  result.Data.thisdata.djsjy != ""
                ) {
                  if (this.item.djsjy_state === "") {
                    this.$message.error("【地级市交验】尚未审核！");
                    return;
                  } else if (this.item.djsjy_state == 1) {
                    this.dialogVisible = true;
                  } else {
                    this.dialogVisible = false;
                  }
                }
              }
            });
        } else {
          this.dialogVisible = false;
          var parms = {
            mainData: {
              data_id: this.item.data_id,
              projectname: this.item.projectname,
              ssfa_sm: this.item.ssfa_shyj,
              jcbg_sm: this.item.jcbg_shyj,
              zjbg_sm: this.item.zjbg_shyj,
              wydcjl_sm: this.item.wydcjl_shyj,
              jjbg_sm: this.item.jjbg_shyj,
              jccwwxgsm_sm: this.item.jccwwxgsm_shyj,
              djsjy_sm: this.item.djsjy_shyj,
              wth_sm: this.item.wth_shyj,
              cyd_sm: this.item.cyd_shyj,
              chzlyy_sm: this.item.chzlyy_shyj,
              ssfa_sh_state: this.item.ssfa_state,
              jcbg_sh_state: this.item.jcbg_state,
              zjbg_sh_state: this.item.zjbg_state,
              yj_state: this.item.yj_state,
              lj_state: this.item.lj_state,
              wydcjl_sh_state: this.item.wydcjl_state,
              jjbg_sh_state: this.item.jjbg_state,
              jccwwxgsm_sh_state: this.item.jccwwxgsm_state,
              djsjy_sh_state: this.item.djsjy_state,
              // wth_sh_state: this.item.wth_state,
               cyd_sh_state: this.item.cyd_state,
              chzlyy_sh_state: this.item.chzlyy_state,
              lj_shyj: this.item.lj_shyj,
              yj_shyj: this.item.yj_shyj,
            },
            detailData: null,
            delKeys: null,
          };
          this.http
            .post("/api/zm_data_record_auditing/add", parms)
            .then((result) => {
              if (result.status == true) {
                var strItem = JSON.parse(result.data);
                if (strItem.data == 1) {
                  this.$router.push("/success");
                } else {
                  this.$router.push("/nopass?id=" + this.item.data_id);
                }

                this.fmodel = true;
              } else {
                this.$router.push("/nopass?id=" + this.item.data_id);
              }
            });
        }

      } else {
        if (
          (this.item.ssfa_state === "" && this.item.zjbg_state === "") ||
          this.item.jcbg_state === "" ||
          this.item.wydcjl_state === "" ||
          this.item.jjbg_state === "" ||
          this.item.jccwwxgsm_state === "" ||
          // this.item.wth_state === "" ||
             this.item.cyd_state === "" ||
          this.item.chzlyy_state === "" ||
          this.item.yj_state === "" ||
          this.item.lj_state === ""
        ) {
          if (this.item.ssfa_state === "") {
            this.$message.error("【任务区实施方案或技术总结报告】尚未审核！");
          }
          if (this.item.jcbg_state === "") {
            this.$message.error("【任务区检查报告】尚未审核！");
          }
          if (this.item.wydcjl_state === "") {
            this.$message.error("【外业调查核查记录表】尚未审核！");
          }
          if (this.item.jjbg_state === "" || this.item.jccwwxgsm_state === "") {
            this.$message.error("【机检记录】中尚有未审核的内容项！");
          }
          // if (this.item.wth_state === "") {
          //   this.$message.error("【委托函】尚未审核！");
          // }
          if (this.item.cyd_state === "") {
            this.$message.error("【抽样单】尚未审核！");
          }
          if (this.item.chzlyy_state === "") {
            this.$message.error("【测绘资料交验移交清单】尚未审核！");
          }

          if (this.item.yj_state === "") {
            this.$message.error("【两级检查】中的一级检查尚未审核！");
          }
          if (this.item.lj_state === "") {
            this.$message.error("【两级检查】中的二级检查尚未审核！");
          }
          return;
        } else {
          if (this.item.djsjyName != "" && this.item.djsjyName != null) {
            if (this.item.djsjy_state === "") {
              this.$message.error("【周边行政区接边记录或说明】尚未审核！");
              return;
            }
          }
        }
        if (
          ((this.item.ssfa_state === "" && this.item.zjbg_state == 1) ||
            (this.item.ssfa_state == 1 && this.item.zjbg_state === "") ||
            (this.item.ssfa_state == 1 && this.item.zjbg_state == 1)) &&
          this.item.jcbg_state == 1 &&
          this.item.yj_state == 1 &&
          this.item.lj_state == 1 &&
          this.item.wydcjl_state == 1 &&
          this.item.jjbg_state == 1 &&
          this.item.jccwwxgsm_state == 1 &&
          // this.item.wth_state == 1 &&
          this.item.cyd_state == 1 &&
          this.item.chzlyy_state == 1
        ) {
          this.http
            .post(
              "/api/zm_data_record/AdminGetDetaileByID?id=" + this.item.data_id
            )
            .then((result) => {
              if (result.Data.thisdata != undefined) {
                if (
                  result.Data.thisdata.djsjy != null &&
                  result.Data.thisdata.djsjy != null &&
                  result.Data.thisdata.djsjy != ""
                ) {
                  if (this.item.djsjy_state === "") {
                    this.$message.error("【地级市交验】尚未审核！");
                    return;
                  } else if (this.item.djsjy_state == 1) {
                    this.dialogVisible = true;
                  } else {
                    this.dialogVisible = false;
                  }
                }
              }
            });
        } {
          this.dialogVisible = false;
          var parms = {
            mainData: {
              data_id: this.item.data_id,
              projectname: this.item.projectname,
              ssfa_sm: this.item.ssfa_shyj,
              jcbg_sm: this.item.jcbg_shyj,
              zjbg_sm: this.item.zjbg_shyj,
              wydcjl_sm: this.item.wydcjl_shyj,
              jjbg_sm: this.item.jjbg_shyj,
              jccwwxgsm_sm: this.item.jccwwxgsm_shyj,
              djsjy_sm: this.item.djsjy_shyj,
              wth_sm: this.item.wth_shyj,
               cyd_sm: this.item.cyd_shyj,
              chzlyy_sm: this.item.chzlyy_shyj,
              ssfa_sh_state: this.item.ssfa_state,
              jcbg_sh_state: this.item.jcbg_state,
              zjbg_sh_state: this.item.zjbg_state,
              yj_state: this.item.yj_state,
              lj_state: this.item.lj_state,
              wydcjl_sh_state: this.item.wydcjl_state,
              jjbg_sh_state: this.item.jjbg_state,
              jccwwxgsm_sh_state: this.item.jccwwxgsm_state,
              djsjy_sh_state: this.item.djsjy_state,
              // wth_sh_state: this.item.wth_state,
              cyd_sh_state: this.item.cyd_state,
              chzlyy_sh_state: this.item.chzlyy_state,
              lj_shyj: this.item.lj_shyj,
              yj_shyj: this.item.yj_shyj,
            },
            detailData: null,
            delKeys: null,
          };

          this.http
            .post("/api/zm_data_record_auditing/add", parms)
            .then((result) => {
              if (result.status == true) {
                var strItem = JSON.parse(result.data);
                if (strItem.data == 1) {
                  this.$router.push("/success");
                } else {
                  this.$router.push("/nopass?id=" + this.item.data_id);
                }

                this.fmodel = true;
              } else {
                this.$router.push("/nopass?id=" + this.item.data_id);
              }
            });
        }
      }
    },
    confirmDate() {
      if (this.selectedDate !== "") {
        const now = new Date();
        const today = new Date(
          now.getFullYear(),
          now.getMonth(),
          now.getDate()
        );
        const targetDate = new Date(
          this.selectedDate.getFullYear(),
          this.selectedDate.getMonth(),
          this.selectedDate.getDate()
        );
        if (targetDate < today) {
          this.selectedDate = "";
          this.$message.error("只能选择今天或今天之后的日期！");
          return;
        } // 禁用今天之前的日期

        var parms = {
          mainData: {
            data_id: this.item.data_id,
            projectname: this.item.projectname,
            ssfa_sm: this.item.ssfa_shyj,
            jcbg_sm: this.item.jcbg_shyj,
            zjbg_sm: this.item.zjbg_shyj,
            wydcjl_sm: this.item.wydcjl_shyj,
            jjbg_sm: this.item.jjbg_shyj,
            jccwwxgsm_sm: this.item.jccwwxgsm_shyj,
            djsjy_sm: this.item.djsjy_shyj,
            wth_sm: this.item.wth_shyj,
            cyd_sm: this.item.cyd_shyj,
            chzlyy_sm: this.item.chzlyy_shyj,
            ssfa_sh_state: this.item.ssfa_state,
            jcbg_sh_state: this.item.jcbg_state,
            zjbg_sh_state: this.item.zjbg_state,
            yj_state: this.item.yj_state,
            lj_state: this.item.lj_state,
            wydcjl_sh_state: this.item.wydcjl_state,
            jjbg_sh_state: this.item.jjbg_state,
            jccwwxgsm_sh_state: this.item.jccwwxgsm_state,
            djsjy_sh_state: this.item.djsjy_state,
            // wth_sh_state: this.item.wth_state,
             cyd_sh_state: this.item.cyd_state,
            chzlyy_sh_state: this.item.chzlyy_state,
            lj_shyj: this.item.lj_shyj,
            yj_shyj: this.item.yj_shyj,
          },
          detailData: null,
          delKeys: null,
        };
        const date = new Date(this.selectedDate);

        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始，需要加1，然后补0
        const day = String(date.getDate()).padStart(2, "0"); // 补0使得日期为两位数

        parms.mainData.shzt = 1;
        parms.mainData.xxtj_time = year + "-" + month + "-" + day;

        //this.vmodel.value = false;
        this.http
          .post("/api/zm_data_record_auditing/add", parms)
          .then((result) => {
            if (result.status == true) {
              var strItem = JSON.parse(result.data);
              if (strItem.data == 1) {
                this.$router.push("/success");
              } else {
                this.$router.push("/nopass?id=" + strItem.data.data_id);
              }
            } else {
              this.$message.error("审核失败,请重新进行审核！");
            }
          });
      } else {
        this.$message.error("请选择线下交验时间！");
      }
    },

    getFileName(url) {
      const cleanUrl = url.replace(/\/+$/, '');
      const lastIndex = cleanUrl.lastIndexOf('/');
      return cleanUrl.substring(lastIndex + 1);

    },
    async getShowPdf(t, fileurl, filename, idx) {
      if (filename == undefined || filename == "") {
        filename = this.getFileName(fileurl);
      }
      debugger;
      var arrs = fileurl.split(',');
      if (arrs.length > 1) {
        fileurl = arrs[idx] + "";
      }
      const extension = fileurl.split('.').pop();
      if (extension === "pdf") {
        this.http
          .get("/api/zm_data_record_auditing/getfile?key=" + fileurl, "", true, {
            responseType: "blob",
          })
          .then((content) => {
            // 创建Blob对象
            const blob = new Blob([content]);
            // 创建下载链接
            const downloadLink = document.createElement('a');
            const url = URL.createObjectURL(blob);
            // 设置下载属性
            downloadLink.href = url;
            downloadLink.download = filename || 'document.pdf'; // 默认文件名
            // 触发下载
            document.body.appendChild(downloadLink);
            downloadLink.click();
            // 清理资源
            setTimeout(() => {
              document.body.removeChild(downloadLink);
              URL.revokeObjectURL(url);
            }, 100);
          });
      } else {
        window.open(fileurl);
      }
    },

    async getdownFile(t) {
      if (t === "yjjl") {
        if (this.item.yjjllist.length > 0) {
          for (var k = 0; k < this.item.yjjllist.length; k++) {
            (function (k) { // 立即执行函数创建闭包
              let item = this.item.yjjllist[k];
              let url = item.url;
              let fileName = item.name;
              debugger;
              const extension = url.split('.').pop();

                this.http.get("/api/zm_data_record_auditing/getfile?key=" + url, "", true, {
                  responseType: "blob"
                }).then((content) => {
                  // 创建唯一DOM元素
                  const downloadLink = document.createElement('a');
                  const objectUrl = URL.createObjectURL(new Blob([content]));

                  downloadLink.href = objectUrl;
                  downloadLink.download = fileName || 'document.pdf';
                  downloadLink.style.display = 'none';

                  document.body.appendChild(downloadLink);
                  downloadLink.click();

                  // 延迟清理
                  setTimeout(() => {
                    document.body.removeChild(downloadLink);
                    URL.revokeObjectURL(objectUrl);
                  }, 1000); // 延长清理时间确保下载完成
                });
            }).call(this, k); // 传递当前循环索引
          }
        }
      } else {
        if (this.item.ljjllist.length > 0) {
          for (var j = 0; j < this.item.ljjllist.length; j++) {
            let url = this.item.ljjllist[j].url;
            let fileName = this.item.ljjllist[j].name;
            debugger;
            const extension = url.split('.').pop();
              this.http
                .get("/api/zm_data_record_auditing/getfile?key=" + url, "", true, {
                  responseType: "blob",
                })
                .then((content) => {
                  // 创建Blob对象
                  const blob = new Blob([content]);
                  // 创建下载链接
                  const downloadLink = document.createElement('a');
                  const url = URL.createObjectURL(blob);
                  // 设置下载属性
                  downloadLink.href = url;
                  downloadLink.download = fileName || 'document.pdf'; // 默认文件名
                  // 触发下载
                  document.body.appendChild(downloadLink);
                  downloadLink.click();
                  // 清理资源
                  setTimeout(() => {
                    document.body.removeChild(downloadLink);
                    URL.revokeObjectURL(url);
                  }, 100);
                });
          }
        }
      }
    },
  },
});
</script>

<style lang="less" scoped>
/* 为 el-drawer 的标题添加下划线 */

.dia-footer {
  text-align: right;
  width: 100%;
  border-top: 1px solid #e2e2e2;
  text-align: right;
  padding: 6px 8px;
}
</style>

<style scoped lang="less">
.vol-dialog ::v-deep(.el-drawer__body) {
  border-top: 1px solid var(--el-menu-border-color);
  padding-top: 10px;
}

.vol-dialog ::v-deep(.el-drawer__header) {
  margin-bottom: 15px !important;
}

.vol-dialog ::v-deep(.el-tabs__item) {
  padding: 0px 15px;
}

.vol-dialog ::v-deep(.el-tabs__item.is-active) {
  color: #000;
  font-weight: bold;
}

.vol-dialog ::v-deep(.el-dialog__header) {
  border-bottom: 1px solid #d0d0d0;
}

.edit_btn {
  min-height: 40px;
  min-width: 100px;
  background: #409eff 80%;
  border: #409eff;
  font-size: 20px;
}
</style>
